import java.util.Scanner;

public class D4 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入正方形边长：");
        int i= scanner.nextInt();
        int k;
        int a;
        for (k = 1; k <=i ; k++) {
            if(k==1|k==i){
                for (a = 1; a <=i ; a++) {
                    System.out.print("*");
                }
                 System.out.println();
            }else{
                System.out.print("*");
                for(a=1;a<=(i-2);a++){
                    System.out.print(" ");
                }
                System.out.println("*");
            }
        }

        }
}
